<{include file="public_html/header.html"}>
<{include file="public_html/left_menu.html"}>

<blockquote class="layui-elem-quote"><{$action}></blockquote>

<fieldset class="layui-elem-field">
    <legend>按条件搜索</legend>
    <div class="layui-field-box">
        <form class="layui-form layui-form-pane1" method="post" action="<{$current_url}>">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <select name="category[school_id]" lay-search="" lay-verify="required" id="school_id" placeholder="请选择学校名称" lay-filter="subject">
                        <option value="">请选择学校名称</option>
                        <{foreach from=$school item=item}>
                            <option value="<{$item.id}>" <{if $data.school_id == $item.id}>selected="selected"<{/if}>><{$item.school_name}></option>
                        <{/foreach}>
                    </select>
                </div>
                <div class="layui-inline">
                    <button type="submit" class="layui-btn">搜索</button>
                </div>
            </div>
        </form>
    </div>
</fieldset>
<table class="layui-table" lay-even lay-skin="row">
    <thead>
        <tr>
            <th width="350">网校名称</th>
            <th width="180">名称</th>
            <th width="220">激活码数量</th>
            <th width="220">授权单价</th>
            <th width="220">确认审核状态</th>
            <th width="220">发布时间</th>
            <th width="220">操作</th>
        </tr>
    </thead>   
    <tbody>
    <{foreach from=$result item=item}>
        <tr>
            <td class="not_lb tal">
               <{$item.school_name}>
            </td>
            <td class="not_lb tal">
            <span class="c-ff6d5e">
            <{if !empty($shixun_list)}>
                <{$shixun_list[$item.data_id]['ztName']}>
            <{else}>
               <{$item.title}> 
            <{/if}>
            </span>
            </td>
            <td class="not_lb tal"><span class="c-ff6d5e"><{$item.num}></span></td>
            <td class="not_lb tal"><span class="c-ff6d5e"><{$item.price}>元</span></td>
            <td class="not_lb tal"><span class="c-ff6d5e"><{if $item.reviewed == 0}><a target="_blank" href="/goods_course/edit/<{$item.id}>"><button class="layui-btn" lay-submit lay-filter="*">确认</button></a><{else}>已发放激活码<{/if}></span></td>
            <td class="not_lb tal">
                <{$item[ 'add_time']|date_format: '%Y-%m-%d <br> %H:%M:%S'}>
            </td>
            <td class="not_lb tal">
                <a href="javascript:;" class="show_system_topic" data_id="<{$item.id}>" data_type="<{$item.data_type}>">查看详情</a>
            </td>
        </tr>
    <{/foreach}>
    <{if $result|count eq 0}>
        <tr>
            <td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="6">
                赞无数据！
            </td>
        </tr>
    <{/if}>
    <tr>
        <td class="center" colspan="12">
            <!-- <input type="checkbox" lay-filter="checkbox_all" title="全选">
            <button id="delete" class="layui-btn layui-btn-primary layui-btn-small" style="margin-top:4px;"><i class="layui-icon"></i> 批量删除</button> -->
        </td>
    </tr>
    </tbody>
</table>
<div class="layui-box layui-laypage layui-laypage-default">
	<{$pagination}>
</div>
<{include file="public_html/footer.html"}>
<script>
    $(function() {
        layui.use(['form','layedit','jquery'], function() {
            var form = layui.form();
            var layedit = layui.layedit;
            $ = layui.jquery;
            form.on('select(cate_id)', function(data){
                var ii = layer.load();
                var id = data.value;
                $("#course_id").html('<option value="">请选择科目</option>');
                form.render('select');
                $.ajax({
                    type: "POST",
                    url: "/course/get_cate_subject",
                    data: {id:id},
                    dataType: "json",
                    success: function (data) {
                        var ddl = $("#subject");
                        var html ='<option value="">请选择科目</option>';
                        $(data).each(function (key) {
                            html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
                        });
                        $("#subject").html(html);
                        form.render('select');
                        layer.close(ii);
                    }
                });
            });  
        });

        $(".show_system_topic").click(function(){
            layer.open({
                type: 2,
                title: '激活码列表',
                shadeClose: true,
                shade: 0.8,
                area: ['90%', '90%'],
                maxmin: true,
                content: '/order_course_auth/school_order_records/'+$(this).attr("data_id")+'/'+$(this).attr("data_type") //iframe的url
            }); 
        })
    })
    
</script>